#{extends 'main.html' /}
#{set title:'CoolSoft - Roles' /}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="" lang=""> 
    <head> 
        <title></title>		
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> 
        <link rel="stylesheet" type="text/css" media="screen" href="/public/stylesheets/crud.css" /> 
		<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<script type="text/javascript" src="/public/javascripts/jquery.simpleMultiSelect.js"></script> 

	<script type="text/javascript"> 
      $(document).ready(function(){
        $('select#object_actions').simpleMultiSelect();
 
        $('a#none').click(function(){
            $('select#object_actions').smsNone();
        });
        $('a#all').click(function(){
            $('select#object_actions').smsAll();
        });
	});
	
  </script> 
		
    </head> 
	<body id="crud"> 			
		<div id="crudContent"> 
			<div id="crudBlank" class="RoleCRUD"> 
				<h2 id="crudBlankTitle">Add System Role</h2> 
				<div class="objectForm"> 
					<div class="crudField"> 
						#{form @RoleCRUD.blankWithInheritance()}
						<input type="hidden" name="projectId" value="${projectId}" />
					<label> 
							Choose Role to inherit from:
					</label>
					<select name="inheritRole" id="inheritRole">
						#{list items:rList, as:'role'}
							<option value="${role.id}" ${inheritRole==role.id ?' selected="true"':'selected="false"'}>${role.title}</option>
						#{/list}
					</select>
					<script type="text/javascript">
	           			 document.getElementById('inheritRole').value = '${r.id}'
	     			</script>
					<input type="submit" name="Inherit" value="Inherit" />
				#{/form}
			</div><br>
				<form action="/rolecrud/create" method="POST" accept-charset="utf-8" enctype="multipart/form-data">		
						<input id="object_isSystem" class="" type="hidden" name="object.isSystem" value="true"/>
					<div class="crudField"> 
						<label for="object_title"> 
							Title: <font color="red">*</font>
						</label> 
						<input id="object_title" class="validate[required]" type="text" name="object.title" value="" size="50" /> 	
						<span class="crudHelp"> 
		        
									Required.
						</span>
					</div>  	
					<br>
						
					<div class="crudField"> 	
						<label for="object_actions"> 
							Allowed Actions: <font color="red">*</font>
						</label> 
						<div class="actions-list">
								<select id="object_actions" class="validate[required]" name="object.actions@id" multiple="yes">
								#{list items:aList, as:'action'}
								#{list items:aSelList, as:'actionSel'}
								#{if action.id==actionSel.id}
								<option value="${action.id}" selected="true">${action}</option>
								%{flag = "true";}%
								#{/if}
								#{/list}
								#{if flag != "true"}
								<option value="${action.id}">${action}</option>
								#{/if}
								%{flag = "false";}%
								#{/list}
								</select>
						</div>
		    			<span class="crudHelp">
		    						At Least one Action is Required.
					   		</span> 
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript: click()" id="none">None</a><b> | </b><a href="javascript: click()" id="all">All</a>
					</div>
					<br><br><br>
					<p class="crudButtons"> 
						<input type="submit" name="_save" value="Save" /> 
						<input type="submit" name="_saveAndContinue" value="Save and continue editing" /> 
						<input type="submit" name="_saveAndAddAnother" value="Save and create another" /> 
					</p> 
				</form>	
				
				</div> 
			</div>
		</div>
	</body> 
</html> 